<?php 
namespace app\index\controller;
use think\Controller;
use geetest\lib\GeetestLib;

define("CAPTCHA_ID", "48a6ebac4ebc6642d68c217fca33eb4d");
define("PRIVATE_KEY", "4f1c085290bec5afdc54df73535fc361");

class User extends Controller
{
    // 登录方法
    



    public function checkGeetest()
    {
        $GtSdk = new GeetestLib(CAPTCHA_ID, PRIVATE_KEY);
        session_start();

        $data = array(
                "user_id" => "test",
                "client_type" => "web", // web: pc端浏览器; h5: 移动端浏览器
                "ip_address" => "127.0.0.1" // 请在此处传输用户请求验证时所携带的ip
        );

        $status = $GtSdk->pre_process($data, 1);
        $_SESSION['gtserver'] = $status;
        $_SESSION['user_id'] = $data['user_id'];
        echo $GtSdk->get_response_str();

    }

    public function _empty(Request $request)
    {
        return view('/error');
    }

}







